package cn.whao.guli.order.controller;

import cn.whao.guli.order.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ClassName: OrderController
 * Package: cn.whao.guli.order.controller
 * Description:
 *
 * @Author 王豪
 * @Create 2024/11/26 16:19
 * @Version 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @GetMapping("{userId}/{productId}/{count}")
    public Boolean createOrder(@PathVariable("userId") String userId,
                               @PathVariable("productId") String productId,
                               @PathVariable("count") Integer count,
                               @RequestParam("userKey") String userKey,
                               @CookieValue("token")String token) {
        System.out.println("userKey: "+userKey);
        System.out.println("token = " + token);
        return orderService.saveOrder(userId, productId, count);
    }
}
